package com.example.demo.entity;

import java.math.BigDecimal;

public class YearDetail {
    private int month;
    private float inmoney;
    private float outmoney;
    private float yuer;

    public YearDetail() {

    }

    public int getMonth() {
        return month;
    }

    public void setMonth(int month) {
        this.month = month;
    }

    public float getInmoney() {
        return inmoney;
    }

    public void setInmoney(float inmoney) {
        this.inmoney = inmoney;
    }

    public float getOutmoney() {
        return outmoney;
    }

    public void setOutmoney(float outmoney) {
        this.outmoney = outmoney;
    }

    public float getYuer() {
        return  yuer=inmoney-outmoney;
    }

    public void setYuer() {
//        BigDecimal bd_in = new BigDecimal(inmoney);
//        BigDecimal bd_out = new BigDecimal(outmoney);
//        BigDecimal result = bd_in.subtract(bd_out);
        float yuer1=inmoney-outmoney;
//        float yuer=(float)(Math.round(yuer1*100)/100);
        BigDecimal bigDecimal = new BigDecimal(yuer1);
        float   yuer   =  bigDecimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue(); //表明四舍五入，保留两位小数
        this.yuer = yuer;
    }
}
